﻿using System;
using System.Html.DOM;


namespace RexToy.UI.Controls
{
    public class VGroupBox : Container
    {
        public VGroupBox()
        {
            this.__domNode = RexToy.UI.Controls.DomNode.Create(new DomNodeCreateOptions()
            {
                tag = Tag.Div,
                hashName = "container",
                className = "ui-corner-all ui-controlgroup ui-controlgroup-vertical"
            });
        }

        public override void AppendControl(Control ctrl)
        {
            ctrl.Standalone = false;
            if (this.__controls.Length == 0)
            {
                ctrl.SetFirst(true);
            }

            var lastCtrl = this.__controls.Last();
            if (lastCtrl != null)
            {
                lastCtrl.SetLast(false);
            }

            this.Super(ctrl);
            ctrl.SetLast(true);
        }
    }
}
